Lecture 15

Interface and application Programming

Assignment: Write an application that interfaces with an input or output device.


Interfacing is the process of making the human machine interface which can be used to control the function of machine. In this asssignment I've created the GUI using the processing


which is JAVA based application to build graphics application.


I have created four buttons when button is pressed respective LED is toogled.

For this week assignment its need to write a source code to interface input or output devices. Term interface is used inside computing to exchange information wheather it will analog or digital signals.Here I did Interfaced with my input output board through arduino and controlled with simple button click.


Interface envirnoment


For interfacing I used processing envirnoment along with arduino and my input output board.

Processing is programming language which is iam gona using for the interfacing.

Using this environment interfaced arduino and my input output board Led's operated with clicking on Led's.






#include "SoftwareSerial.h";


SoftwareSerial mySerial(A1, A0);


int delay1 = 100;

char val = 0;


void setup() {


mySerial.begin(9600);

// put your setup code here, to run once:

pinMode(A7, OUTPUT);

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

pinMode(10, OUTPUT);

}


int pin = 10;


void loop() {

// put your main code here, to run repeatedly:

if (mySerial.available() > 0) {

val = char(mySerial.read());

if (val == '1') {

digitalWrite(A7, !digitalRead(A7));

}

else if (val == '2') {

digitalWrite(8, !digitalRead(8));

}

else if (val == '3') {

digitalWrite(9, !digitalRead(9));

}

else if (val == '4') {

digitalWrite(10, !digitalRead(10));

}

else if (val == '0') {

digitalWrite(10, LOW);

digitalWrite(9, LOW);

digitalWrite(8, LOW);

digitalWrite(A7, LOW);

} } }